<template>
	<view>
		<u-navbar title="全部评论" placeholder autoBack></u-navbar>
		<u-line color="#f2f2f2"></u-line>
		<view class="bg-white p-2" >
			
				<view class="p-1" v-for="item in list" :key="item.id">
					<!-- 用户 -->
					<view class="flex align-center">
						<u-avatar :src="item.avatar" size="48" shape="circle"></u-avatar>
						<view class="ml-2 mt-2">
							<u--text mode="name" :text="item.nickname" format="encrypt"></u--text>
							<view class="font-small text-light9">{{item.createtime}}</view>
						</view>
					</view>
					<!-- 频分 -->
					<view class="my-3">
						<u-rate count="5" v-model="item.goods_star" readonly active-color="#ffc000"></u-rate>
					</view>
				    <!-- 评论文本 -->
					<view class="mt-2">
						<u-text
							:text="item.comment"
							lines="3"></u-text>
					</view>
					<!-- 图片 -->
					<template >
					    <u-grid :col="3":border="false">
					    	<u-grid-item :custom-style="{'padding-bottom':0}" v-for="(pic,index) in item.images" :key="index">
					    		<image :src="pic"  style="width: 202rpx;height: 202rpx;"></image>	
					    	</u-grid-item>
					    </u-grid>
					</template>
				    <u-line color="#f2f2f2"></u-line>
				</view>

			<!-- <template v-else>
				<u-empty mode="data" marginTop="150"></u-empty>
			</template> -->
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				list:[]
			}
		},
		onLoad(e) {
			this.getComment(e.goodId)
		},
		methods: {
			getComment(goodsId) {
				this.$api.commentMore({
					good_id: goodsId,
					page:1
				}).then(res => {
					if (res.code === 1) {
						
						if(res.data.length>0){
							this.list = res.data
							console.log(this.list)
						}
					}
				})
			},
		}
	}
</script>

<style scoped>
	 
 page {
	 background-color: #fff;
 }
</style>
